'use client';

import Link from 'next/link';
import { usePathname } from 'next/navigation';

export default function LanguageSwitcher() {
  const pathname = usePathname();

  const isEnglish = pathname.startsWith('/en');
  const newPath = isEnglish ? '/zh-TW' : '/en';
  const buttonText = isEnglish ? '繁體中文' : 'English';

  return (
    <Link href={newPath}>
      <button className="px-4 py-2 text-white border-2 border-white rounded-md hover:bg-white hover:text-black transition-colors">
        {buttonText}
      </button>
    </Link>
  );
}
